﻿using System;
using Conference.Core.Sal.DataContracts;
using Conference.Core.Sal.DataRequests;
using Conference.Core.Sal.DataResponses;
using Conference.Server.DL;
using Conference.Server.Synchronization;
using Conference.Core.Sal.Services;
using TeaLightV5.Foundation.Sal.DataRequests;
using TeaLightV5.Foundation.Sal.DataResponses;

namespace Conference.Server
{
    public partial class SynchronizeService : ISynchronizeService
    {
        #region Session

        public SessionDataResponse GetSessionsByModifiedDate(GetByModifiedDateRequest request)
        {
            SyncSession sync = new SyncSession();
            return sync.GetByModifiedDate(request.FromDate);
        }

        public DeletedRowDataResponse<Guid> GetDeletedSessionsByModifiedDate(GetByModifiedDateRequest request)
        {
            SyncSession sync = new SyncSession();
            return sync.GetDeletedRowsByModifiedDate(request.FromDate);
        }

        public void UpdateSessions(SessionDataRequest data)
        {
            SyncSession sync = new SyncSession();
            sync.Update(data);
        }

        public void DeleteSessions(DeletedRowDataRequest<Guid> deleted)
        {
            SyncSession sync = new SyncSession();
            sync.Delete(deleted);
        }

        #endregion

        #region Speaker

        public SpeakerDataResponse GetSpeakersByModifiedDate(GetByModifiedDateRequest request)
        {
            SyncSpeaker sync = new SyncSpeaker();
            return sync.GetByModifiedDate(request.FromDate);
        }

        public DeletedRowDataResponse<Guid> GetDeletedSpeakersByModifiedDate(GetByModifiedDateRequest request)
        {
            SyncSpeaker sync = new SyncSpeaker();
            return sync.GetDeletedRowsByModifiedDate(request.FromDate);
        }

        public void UpdateSpeakers(SpeakerDataRequest data)
        {
            SyncSpeaker sync = new SyncSpeaker();
            sync.Update(data);
        }

        public void DeleteSpeakers(DeletedRowDataRequest<Guid> deleted)
        {
            SyncSpeaker sync = new SyncSpeaker();
            sync.Delete(deleted);
        }

        #endregion

        #region SessionSpeaker

        public SessionSpeakerDataResponse GetSessionSpeakersByModifiedDate(GetByModifiedDateRequest request)
        {
            SyncSessionSpeaker sync = new SyncSessionSpeaker();
            return sync.GetByModifiedDate(request.FromDate);
        }

        public DeletedRowDataResponse<Guid> GetDeletedSessionSpeakersByModifiedDate(GetByModifiedDateRequest request)
        {
            SyncSessionSpeaker sync = new SyncSessionSpeaker();
            return sync.GetDeletedRowsByModifiedDate(request.FromDate);
        }

        public void UpdateSessionSpeakers(SessionSpeakerDataRequest data)
        {
            SyncSessionSpeaker sync = new SyncSessionSpeaker();
            sync.Update(data);
        }

        public void DeleteSessionSpeakers(DeletedRowDataRequest<Guid> deleted)
        {
            SyncSessionSpeaker sync = new SyncSessionSpeaker();
            sync.Delete(deleted);
        }

        #endregion

	}
}
